package com.sanron.sunweather.fragment;

import com.sanron.sunweather.entity.WeatherData;

import de.greenrobot.event.EventBus;
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.app.Fragment;

public abstract class BaseFragment extends Fragment{
	
	protected EventBus eventBus;
	protected WeatherData weatherData;
	protected Handler handler = new Handler();
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		eventBus = EventBus.getDefault();
	}
	
	public void setWeatherData(WeatherData weatherData){
		this.weatherData = weatherData;
	}
	
	public void refreshViews(){
		handler.post(new Runnable() {
			@Override
			public void run() {
				updateViews();
			}
		});
		
	}
	protected abstract void updateViews();
	
	@Override
	public void onDestroy() {
		super.onDestroy();
	}
}
